Skip to content

Support all mysql flags while importing database - #123

Merged
schlessera merged 4 commits into
wp-cli:masterfrom
abhijitrakas:feature/mysql-flags
Dec 3, 2018
Merged

schlessera merged 4 commits into
wp-cli:masterfrom
abhijitrakas:feature/mysql-flags

Conversation

@abhijitrakas

Copy link
Copy Markdown
Contributor

Commit for wp-cli/ideas#112

@schlessera schlessera left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this first iteration, @abhijitrakas !

First of all, we should add at least 1 test in the Behat suite to test and assert that the arguments are actually passed onto mysql.

Then I have a few thoughts regarding the implementation. You have directly implemented this as part of the db import command now, but I think that every command that works by providing arguments to run the mysql binary would be abel to benefit from this improvement. So I think it would be preferable to implement this in a separate method called get_mysql_args( $assoc_args ) (similar to get_dbuser_dbpass_args( $assoc_args )), and then feed the resulting array of arguments into the run() or run_query() method.

Comment thread src/DB_Command.php Resolved
@schlessera schlessera added the command:db-import Related to 'db import' command label Nov 14, 2018
@abhijitrakas

Copy link
Copy Markdown
Contributor Author

@schlessera Ok, cool. So we allow only flags which are mention in MySql Doc check Table 4.12 mysqlimport Options table. Correct me if I am wrong.

@schlessera

Copy link
Copy Markdown
Member

@abhijitrakas No, we are actually using the mysql binary, not the mysqlimport one. So the options would be the ones documented here: https://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html

@abhijitrakas

Copy link
Copy Markdown
Contributor Author

@schlessera Please check updated PR.

Comment thread src/DB_Command.php Resolved
Comment thread src/DB_Command.php Resolved
Comment thread src/DB_Command.php Resolved
Comment thread src/DB_Command.php Resolved
Comment thread src/DB_Command.php Resolved
Comment thread src/DB_Command.php Resolved
@schlessera schlessera added this to the 2.0.1 milestone Dec 3, 2018
@schlessera

Copy link
Copy Markdown
Member

Thanks for the PR, @abhijitrakas !

@schlessera
schlessera merged commit 99188aa into wp-cli:master Dec 3, 2018
@schlessera schlessera changed the title Allow all mysql flags while importing database Support all mysql flags while importing database Dec 3, 2018
danielbachhuber pushed a commit that referenced this pull request Nov 18, 2022
Support all `mysql` flags while importing database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:db-import Related to 'db import' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants